﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace Infrastructure.Converters
{
    public class WCNOConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null) return null;
            if (WCNOMapping.WCNOS.ContainsKey(value.ToString())) return WCNOMapping.WCNOS[value.ToString()];
            else return value.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            foreach (var item in WCNOMapping.WCNOS)
            {
                if (item.Value == value.ToString())
                    return item.Key;
            }
            return value.ToString();
        }
    }
}
